package org.jeecg.modules.ParameterModule.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.ParameterModule.entity.CategoryMaterialInfo;
import org.jeecg.modules.ParameterModule.entity.MlccCategoryInfo;
import org.jeecg.modules.ParameterModule.mapper.FormalCategoryInfoMapper;
import org.jeecg.modules.ParameterModule.mapper.FormalPlateInfoMapper;
import org.jeecg.modules.ParameterModule.service.FormalCategoryInfoService;
import org.jeecg.modules.ParameterModule.service.FormalPlateInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FormalPlateInfoServiceImpl implements FormalPlateInfoService {
    @Autowired
    private FormalPlateInfoMapper logicMapper;

    /**
     * 版号列表+分页
     * */
    @Override
    public IPage<MlccCategoryInfo> query_CategoryPageList(Page<MlccCategoryInfo> page, String queryName, String queryCode,String pingleiName) {
        IPage<MlccCategoryInfo> pagelist = logicMapper.query_CategoryPageList(page,queryName,queryCode,pingleiName);
        return pagelist;
    }
    /**版号下的里布列表*/
    @Override
    public IPage<CategoryMaterialInfo> query_material_libuPageList(Page<CategoryMaterialInfo> page, String category_id, String queryName, String queryCode) {
        IPage<CategoryMaterialInfo> pagelist = logicMapper.query_material_libuPageList(page,category_id,queryName,queryCode);
        return pagelist;
    }
    /**版号下的低领里列表*/
    @Override
    public IPage<CategoryMaterialInfo> query_material_dilingliPageList(Page<CategoryMaterialInfo> page, String category_id, String queryName, String queryCode) {
        IPage<CategoryMaterialInfo> pagelist = logicMapper.query_material_dilingliPageList(page,category_id,queryName,queryCode);
        return pagelist;
    }
    /**版号下的纽扣列表*/
    @Override
    public IPage<CategoryMaterialInfo> query_material_buttonsPageList(Page<CategoryMaterialInfo> page, String category_id, String queryName, String queryCode) {
        IPage<CategoryMaterialInfo> pagelist = logicMapper.query_material_buttonsPageList(page,category_id,queryName,queryCode);
        return pagelist;
    }
    /**查询所有的里布/底领尼/纽扣*/
    @Override
    public List<CategoryMaterialInfo> query_all_materialInfo(int type) {
        List<CategoryMaterialInfo> datalist = logicMapper.query_all_materialInfo(type);
        return datalist;
    }
    /**查询所有的测试辅料*/
    @Override
    public List<CategoryMaterialInfo> query_AllfuliaoBypingleiId(String plate_id) {
        List<CategoryMaterialInfo> datalist = logicMapper.query_AllfuliaoBypingleiId(plate_id);
        return datalist;
    }

    @Override
    public int add_plate_libu(CategoryMaterialInfo testinfo) {
        try {
            logicMapper.add_plate_libu(testinfo);
            return 1;
        }catch (Exception e){
            System.out.print("新增失败"+e.toString());
            return 0;
        }
    }

    @Override
    public int delete_plate_libu(String id) {
        try {
            logicMapper.delete_plate_libu(id);
            return 1;
        }catch (Exception e){
            System.out.print("删除失败"+e.toString());
            return 0;
        }
    }

    @Override
    public int add_plate_dilingli(CategoryMaterialInfo testinfo) {
        try {
            logicMapper.add_plate_dilingli(testinfo);
            return 1;
        }catch (Exception e){
            System.out.print("新增失败"+e.toString());
            return 0;
        }
    }

    @Override
    public int delete_plate_dilingli(String id) {
        try {
            logicMapper.delete_plate_dilingli(id);
            return 1;
        }catch (Exception e){
            System.out.print("删除失败"+e.toString());
            return 0;
        }
    }

    @Override
    public int add_plate_buttons(CategoryMaterialInfo testinfo) {
        try {
            logicMapper.add_plate_buttons(testinfo);
            return 1;
        }catch (Exception e){
            System.out.print("新增失败"+e.toString());
            return 0;
        }
    }

    @Override
    public int delete_plate_buttons(String id) {
        try {
            logicMapper.delete_plate_buttons(id);
            return 1;
        }catch (Exception e){
            System.out.print("删除失败"+e.toString());
            return 0;
        }
    }

    @Override
    public int update_price_pinglei(String pinglei_id,String banhao_id) {
        try {
            logicMapper.update_price_pinglei(pinglei_id,banhao_id);
            return 1;
        }catch (Exception e){
            System.out.print("删除失败"+e.toString());
            return 0;
        }
    }
}
